package com.martin.simpledevelop.utils.device;
import android.content.Context;
import android.telephony.TelephonyManager;
import com.martin.simpledevelop.utils.log.SaLogUtils;
/**
* @Description 获取手机信息工具类<br>
* @File SaDeviceUtils.java
* @Package com.martin.simpledevelop.utils.device
* @Date 2015年6月26日上午1:09:26
* @Author Donghongyu 1358506549@qq.com
* @Version v1.0.0
*/
public class SaDeviceUtils {
/**
* Log 输出标签
*/
public static String TAG = SaDeviceUtils.class.getName();
/**
* 获取应用程序的IMEI号
*
* @param context
* @return
*/
public static String getIMEI(Context context) {
if (context == null) {
SaLogUtils.e(TAG, "getIMEI context为空");
}
TelephonyManager telecomManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String imei = telecomManager.getDeviceId();
SaLogUtils.i(TAG, "IMEI标识:" + imei);
return imei;
}
/**
* 获取设备的系统版本号
*
* @return
*/
public static int getDeviceSDK() {
int sdk = android.os.Build.VERSION.SDK_INT;
SaLogUtils.i(TAG, "设备版本:" + sdk);
return sdk;
}
/**
* 获取设备的型号
*
* @return
*/
public static String getDeviceName() {
String model = android.os.Build.MODEL;
SaLogUtils.i(TAG, "设备型号:" + model);
return model;
}
}